// 
// Copyright 2010 Classpath Pty Ltd <opensource@classpath.com.au>
// 
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// 
//     http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// 

**
** Represents the ability to use a column option from within part of a column change.
**
mixin CanUseColumnOptions : HasModifications {

    **
    ** Creates a `AutoIncrementColumnOption` for use as a `ColumnOption` and stores it in the column options being tracked by the mixed in class.
    **
    AutoIncrementColumnOption autoIncrement() {
        Pod.of(this).log.debug("${typeof}.autoIncrement - start")
        option := AutoIncrementColumnOption()
        modifications.add(option)
        Pod.of(this).log.debug("${typeof}.autoIncrement - end - returning ${option}")
        return option
    }

    **
    ** Creates a `CheckColumnOption` for use as a `ColumnOption` and stores it in the column options being tracked by the mixed in class.
    **
    CheckColumnOption check(Str check) {
        Pod.of(this).log.debug("${typeof}.check(${check}) - start")
        option := CheckColumnOption(check)
        modifications.add(option)
        Pod.of(this).log.debug("${typeof}.check(${check}) - end - returning ${option}")
        return option
    }

    **
    ** Creates a `CommentColumnOption` for use as a `ColumnOption` and stores it in the column options being tracked by the mixed in class.
    **
    CommentColumnOption comment(Str comment) {
        Pod.of(this).log.debug("${typeof}.comment(${comment}) - start")
        option := CommentColumnOption(comment)
        modifications.add(option)
        Pod.of(this).log.debug("${typeof}.comment(${comment}) - end - returning ${option}")
        return option
    }

    **
    ** Creates a `DefaultValueColumnOption` for use as a `ColumnOption` and stores it in the column options being tracked by the mixed in class.
    **
    DefaultValueColumnOption defaultValue(Str defaultValue) {
        Pod.of(this).log.debug("${typeof}.defaultValue(${defaultValue}) - start")
        option := DefaultValueColumnOption(defaultValue)
        modifications.add(option)
        Pod.of(this).log.debug("${typeof}.defaultValue(${defaultValue}) - end - returning ${option}")
        return option
    }

    **
    ** Creates a `NotNullColumnOption` for use as a `ColumnOption` and stores it in the column options being tracked by the mixed in class.
    **
    NotNullColumnOption notNull() {
        Pod.of(this).log.debug("${typeof}.notNull - start")
        option := NotNullColumnOption()
        modifications.add(option)
        Pod.of(this).log.debug("${typeof}.notNull - end - returning ${option}")
        return option
    }

    **
    ** Creates a `PrimaryKeyColumnOption` for use as a `ColumnOption` and stores it in the column options being tracked by the mixed in class.
    **
    ReferencesColumnOption references(Str referencedTable, Str referencedColumn) {
        Pod.of(this).log.debug("${typeof}.references(${referencedTable}, ${referencedColumn}) - start")
        reference := Reference(referencedTable, [referencedColumn])
        option := ReferencesColumnOption(reference)
        modifications.add(option)
        Pod.of(this).log.debug("${typeof}.references(${referencedTable}, ${referencedColumn}) - end - returning ${option}")
        return option
    }

    **
    ** Creates a `PrimaryKeyColumnOption` for use as a `ColumnOption` and stores it in the column options being tracked by the mixed in class.
    **
    PrimaryKeyColumnOption primaryKey() {
        Pod.of(this).log.debug("${typeof}.primaryKey - start")
        option := PrimaryKeyColumnOption()
        modifications.add(option)
        Pod.of(this).log.debug("${typeof}.primaryKey - end - returning ${option}")
        return option
    }

    **
    ** Creates a `UniqueColumnOption` for use as a `ColumnOption` and stores it in the column options being tracked by the mixed in class.
    **
    UniqueColumnOption unique() {
        Pod.of(this).log.debug("${typeof}.unique - start")
        option := UniqueColumnOption()
        modifications.add(option)
        Pod.of(this).log.debug("${typeof}.unique - end - returning ${option}")
        return option
    }

}
